package org.rency.crawler.common.enums;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * 描述: 配置类别条目<br>
 * 最近修改时间:2017/9/8 16:15<br>
 *
 * @author CaiyuRen
 * @version V1.0
 * @since 2017/9/8 16:15
 */
public enum FirLevelKind {

  SYSTEM("SYSTEM","系统配置","system"),
  INET("INET","网络配置","inet"),
  CACHE("CACHE","缓存配置","cache"),
  FETCH("FETCH","抓取配置","fetch"),
  ;

  private String       code;
  private String       msg;
  private String       key;

  FirLevelKind(String code, String msg, String key){
    this.code = code;
    this.msg = msg;
    this.key = key;
  }

  public static FirLevelKind get(String code){
    for(FirLevelKind kind : FirLevelKind.values()){
      if(code.equalsIgnoreCase(kind.code)){
        return kind;
      }
    }
    return null;
  }

  public String getCode() {
    return code;
  }

  public String getMsg() {
    return msg;
  }

  public String getKey() {
    return key;
  }

  @Override
  public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
  }
}